def get_digit_count(num):
    # 获取位数
    count = 0
    while num != 0:
        num //= 10
        count += 1
    return count


def get_sum(n):
    # 获取1~n的和
    count = 0
    for x in range(1, n + 1):
        count += x
    return count


def get_digit_sum(x):

    sum = 0
    while x != 0:
        sum += x % 10
        x //= 10
    return sum


def difference(num):
    # 检验每个数字是不是不一样
    set_diff = set()
    digit_count = get_digit_count(num)
    while num != 0:
        set_diff.add(num % 10)
        num //= 10
    if digit_count == len(set_diff):
        return True
    return False

def process(num):
    # 检验是不是全数字
    # 每个数字都不一样且和等于1到n的和
    # 获取所有位数的和
    # 检验每个数字是不是不一样
    if get_digit_sum(num) == get_sum(get_digit_count(num)) and difference(num):
        return True
    return False


def find_pandigital(*args):
    res_list = list()
    for x in args:
        if process(x):
            res_list.append(x)
    return res_list

print(find_pandigital(321, 1324, 1243, 2354, 322))